import request from '@/utils/request'
import {
	ref,
} from 'vue'

export default () => {
	const userInfoState = ref(null)

	const appts = ref({
		gappts:null,
		pappts:null
	})
	const sales = ref({
		gsales:null,
		psales:null
	})
	const activities = ref([])
	const signs = ref({
		gsigns:null,
		psigns:null
	})
	const groupactivities = ref([])
	const getUserInfo = async (i) => {
		userInfoState.value = await request.get(`mini/userinfo`)
	}

	const getUserAppt = async () => {
		appts.value = await request.get("mini/user/appt")
	}

	const getUserSale = async () => {
		sales.value = await request.get("mini/user/sale")
	}
	const getUserActivity = async () => {
		activities.value = await request.get("mini/user/activity")
	}
	const getUserSign = async () => {
		signs.value = await request.get("mini/user/sign")
	}
	
	const getMygroupactivities = async () => {
		groupactivities.value = await request.get(`mini/user/groupactivity`)
	}
	return {
		getUserInfo,
		userInfoState,
		getUserAppt,
		getUserSale,
		getUserActivity,
		getUserSign,
		getMygroupactivities,
		appts,
		sales,
		activities,
		signs,
		groupactivities
		
	}
}